<template>
  <div>
    <div v-if="isPageLoading" class="page_loading fixed">
      <van-loading size="24px" vertical color="#fff">加载中...</van-loading>
    </div>
    <header>
      <van-nav-bar class="main_header" :title="title">
        <template #left>
          <span @click="goBack">返回</span>
        </template>
      </van-nav-bar>
    </header>
    <div class="gl_padding_15">
      <p class="title">{{ detail.title }}</p>
      <p class="text">{{ detail.createTime | FormatDate('yyyy-MM-dd HH:mm:ss') }}</p>
      <van-divider />
      <p style="font-size: 12px; color: #333333" v-html="detail.content" />
    </div>
  </div>
</template>

<script>
import { api_GET_MessageGetReceiveMessagesByContent } from '@/extend/api/swaggerApi/chat.js';
import { Api_GET_MessageGetReceiveMessagesByContentQO } from '@/lib/form/swaggerForm';
export default {
  name: 'NoticeDetail',
  data() {
    return {
      title: '消息详情',
      isPageLoading: false,
      Api_GET_MessageGetReceiveMessagesByContentQO: new Api_GET_MessageGetReceiveMessagesByContentQO(),
      detail: {}
    };
  },
  created() {
    this.getDetail();
  },
  methods: {
    getDetail() {
      var that = this;
      that.isPageLoading = true;
      that.Api_GET_MessageGetReceiveMessagesByContentQO.content = that.$route.query.title;
      api_GET_MessageGetReceiveMessagesByContent(that.Api_GET_MessageGetReceiveMessagesByContentQO).then(res => {
        that.isPageLoading = false;
        const detail = res.items.filter((item) => {
          return item.messageID === that.$route.query.id;
        });
        that.detail = detail[0];
      }).catch(res => {
        that.isPageLoading = false;
      });
    },
    goBack() {
      this.$router.push({
        path: `/myCenter${this.gameId && '/' + this.gameId || ''}/notice/`
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.text {
  color: #969799;
  font-size: 12px;
}
.title{
  font-size: 14px;
  font-weight: 500;
  color: #333333;
}
</style>
